//logs.js
const chooseLocation = requirePlugin('chooseLocation');
var time = require("../../utils/util.js");
// 引用百度地图微信小程序JSAPI模块 
var bmap = require('../../libs/bmap-wx.min.js');
var wxMarkerData = [];	//定位成功回调对象
const app = getApp()
import Dialog from '../../@vant/weapp/dialog/dialog';
Page({
  data: {
    orderid: '',
    ak:"KdZjo4KT7pfqWZovH40CIgtxOlFkax03",	//填写申请到的ak
    fileList: [],
    value: '',
    time: '',
    type: '',   //违法类型
    typeid: '',
    tempFilePaths: '',
    images: [],
    videos: [],
    images1: [],     //不加http
    videos1: [],    //不加http
    videos2: [],    //缩略图
    show: false,
    show1: false,
    road: '',   //所选辖区
    road1: '',   //辖区改变
    areaList: [   //自选路段数据
      {
        values: [],
        className: 'column1',
      },
      {
        values: [],
        className: 'column2',
      },
      {
        values: [],
        className: 'column3',
      }
    ],
    lng: '',
    lat: '',
    nowcity: '',
    city: [],   //城市
    highspeed: [],   //高速
    Jurisdiction: [],   //辖区
    carroad: false,
    cartype: '',
    cartypeid: '',
    cartime: false,
    minHour: 10,
    maxHour: 20,
    minDate: new Date().getTime(),
    maxDate: new Date().getTime(),
    currentDate: new Date().getTime(),
    showcar: '',
    columns: ['蓝牌', '黄牌', '黑牌', '个性牌', '小型新能源车牌号', '大型新能源车牌号'],
    username: '',
    idnumber: '',
    phone: '',
    btnshow: false,
    shownumber: '',
    isKeyboard: !1,
    isNumberKB: !1,
    tapNum: !1,
    disableKey: "1234567890港澳学",
    keyboardNumber: "1234567890ABCDEFGHJKLMNPQRSTUVWXYZ港澳学",
    keyboard1: "京沪粤津冀晋蒙辽吉黑苏浙皖闽赣鲁豫鄂湘桂琼渝川贵云藏陕甘青宁新",
    inputPlates: {
      index0: "",
      index1: "",
      index2: "",
      index3: "",
      index4: "",
      index5: "",
      index6: "",
      index7: ""
    },
    inputOnFocusIndex: "",
    flag:true,
    reasonshow: true,
    overlayshow: false,
    inputhide: false
  },
  onLoad: function(options){
    console.log(options);
    var that = this
    if(options.orderid != undefined && options.orderid != 'undefined' && options.orderid != null){
      that.setData({
        orderid: options.orderid,
        type: options.typename
      })
      that.setData({
        show1: true,
        btnshow: true,
      })
      wx.request({    
        url: time.httpurl + '/api/getOrder',
        method: 'POST',
        data: {
          id: that.data.orderid,
        },
        header: {
          'AppType': 'AppType',
          'Authorization': wx.getStorageSync("token"),
        },
        success: function (res) {
          console.log(res,'order');
          if(res.data.code == 200){            
            if(res.data.data.pictureList != ''){
              var imgs = [];
              for(var i=0;i<res.data.data.pictureList.split(',').length;i++){
                imgs.push(time.httpurlvideo + res.data.data.pictureList.split(',')[i])
              }
            }
            if(res.data.data.video != ''){
              var video = [];
              for(var i=0;i<res.data.data.video.split(',').length;i++){
                video.push(time.httpurlvideo + res.data.data.video.split(',')[i])
              }
            }  
            if(res.data.data.status == 2){
              that.setData({
                reasonshow: false
              })
            }else{
              that.setData({
                reasonshow: true
              })
            }
            that.setData({
              value: res.data.data.content,
              images: imgs,
              videos: video,
              time: res.data.data.illegalTime,
              road: res.data.data.locationInformation,
              cartype: res.data.data.carTypeName,
              carnumber: res.data.data.carNumber,
              username: res.data.data.reportName,
              idnumber: res.data.data.idNumber,
              phone: res.data.data.phone,
              reason: res.data.data.dismissReason,
              type: res.data.data.typeName,
            })
          }else if(res.data.code == 401 || res.data.code == 403){
            app.login();
          }else{
            wx.showToast({
              title: res.data.msg,
              icon: 'none',
              duration: 2000
            })
          }     
        }
      })
    }
  },
})
